// MESSAGE DOWNLINK_PARAMS support class

#pragma once

namespace mavlink {
namespace fppa {
namespace msg {

/**
 * @brief DOWNLINK_PARAMS message
 *
 * Sattellite downlink params
 */
struct DOWNLINK_PARAMS : mavlink::Message {
    static constexpr msgid_t MSG_ID = 202;
    static constexpr size_t LENGTH = 25;
    static constexpr size_t MIN_LENGTH = 25;
    static constexpr uint8_t CRC_EXTRA = 163;
    static constexpr auto NAME = "DOWNLINK_PARAMS";


    float frequency; /*<  downlink frequency(MHz). */
    float symbol_rate; /*<  downlink symbol rate. */
    float polar_type; /*<  downlink polar polar_type. */
    uint8_t type; /*<  The params of beacon at dvb/beacon/radio mode. */
    float res1; /*<  res1. */
    float res2; /*<  res2. */
    float res3; /*<  res3. */


    inline std::string get_name(void) const override
    {
            return NAME;
    }

    inline Info get_message_info(void) const override
    {
            return { MSG_ID, LENGTH, MIN_LENGTH, CRC_EXTRA };
    }

    inline std::string to_yaml(void) const override
    {
        std::stringstream ss;

        ss << NAME << ":" << std::endl;
        ss << "  frequency: " << frequency << std::endl;
        ss << "  symbol_rate: " << symbol_rate << std::endl;
        ss << "  polar_type: " << polar_type << std::endl;
        ss << "  type: " << +type << std::endl;
        ss << "  res1: " << res1 << std::endl;
        ss << "  res2: " << res2 << std::endl;
        ss << "  res3: " << res3 << std::endl;

        return ss.str();
    }

    inline void serialize(mavlink::MsgMap &map) const override
    {
        map.reset(MSG_ID, LENGTH);

        map << frequency;                     // offset: 0
        map << symbol_rate;                   // offset: 4
        map << polar_type;                    // offset: 8
        map << res1;                          // offset: 12
        map << res2;                          // offset: 16
        map << res3;                          // offset: 20
        map << type;                          // offset: 24
    }

    inline void deserialize(mavlink::MsgMap &map) override
    {
        map >> frequency;                     // offset: 0
        map >> symbol_rate;                   // offset: 4
        map >> polar_type;                    // offset: 8
        map >> res1;                          // offset: 12
        map >> res2;                          // offset: 16
        map >> res3;                          // offset: 20
        map >> type;                          // offset: 24
    }
};

} // namespace msg
} // namespace fppa
} // namespace mavlink
